﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Security.Cryptography;
using System.Data.SqlClient;

public partial class 用户管理_register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        MD5 md5 = new MD5CryptoServiceProvider();
        int seed = DateTime.Now.GetHashCode();
        string username = this.TextBox1.Text;
        string password = this.TextBox2.Text;
        password += seed.ToString();
        byte[] b = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(password));
        password = "";
        for (int i = 0; i < b.Length; i++)
        {
            password += b[i].ToString("X");
        }
        //Response.Write(password);
        SqlConnection conn = DataBase.getConnection();

        管理员信息表 ad = new 管理员信息表();
        ad.username = username;
        ad.password = password;
        ad.degree = DBNull.Value.ToString();
        ad.seed = seed.ToString();

        管理员信息表dao ad_dao = new 管理员信息表dao();
        ad_dao.Add(ad);
        

        
            Response.Redirect("../login.aspx");

    }
}
